import type {PluginOption} from 'vite'
import Vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
import AutoImport from 'unplugin-auto-import/vite'
import Pages from 'vite-plugin-pages'
import WindiCSS from 'vite-plugin-windicss'


/**
 * 获取vite插件
 * @returns 返回插件集合
 */
export default function loadVitePlugins() {
    const plugins: PluginOption[] = [
        Vue(),
        Components({
            resolvers:[ElementPlusResolver()]
        }),
        AutoImport({
            imports:['vue','vue-router','pinia'],
            dts: 'types/auto-imports.d.ts',
            resolvers:[ElementPlusResolver()],
        }),
        Pages({
            dirs: 'src/page',
            exclude: ['**/components/*.vue']
        }),
        WindiCSS()
    ]
    return plugins
}